/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utilities;

import com.googlecode.javacv.CanvasFrame;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;

/**
 *
 * @author HOME
 */
public class FinalImageCanvas extends Canvas {

    CanvasFrame canvas = new CanvasFrame("Final Image");
    int prevX = 0, prevY = 0;
    JPanel jp = new JPanel();


    {
        canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
        canvas.setContentPane(jp);
    }

    public void paint(int posX, int posY,String colour) {
     //   System.out.println("paint "+colour);
        Graphics g = jp.getGraphics();
        if ((prevX == 0 && prevY == 0) ||(posX==0 && posY==0)) {
            canvas.setSize(800, 600);
        } else {
            canvas.setSize(800, 600);
            g.setColor(Color.getColor(colour));
            //  g.fillOval(1000 - posX, posY, 10, 10);
            g.drawLine(prevX, prevY, posX, posY);
            System.out.println("X= "+posX+" Y= "+posY);
        }

        prevX = posX;
        prevY = posY;

    }

  
}


